<!DOCTYPE html>
<html xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#">
<head>
    <meta charset="UTF-8">
    <title><?php echo $seo_title;?></title>
    <meta name="title" content="<?php echo $seo_title;?>" />
    <meta name="keywords"  content="<?php echo $seo_keyword;?>" />
    <meta name="description" content="<?php echo $seo_description;?>" />
	<link rel="icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />
	<link rel="shortcut icon" href="<?php echo image_asset_url('../css/images/favicon.ico');?>" type="image/x-icon" />
    <meta property="fb:app_id" content="<?php echo $fb_api;?>" />
    <meta property="og:type" content="<?php echo $fb_type;?>" />
    <?php if(!empty($fb_title)):?><meta property="og:title" content="<?php echo $fb_title;?>" /><?php endif;?>
	
    <?php if(!empty($fb_image)):?><meta property="og:image" content="<?php echo $fb_image;?>" /><?php endif;?>
	
    <?php if(!empty($fb_description)):?><meta property="og:description" content="<?php echo $fb_description;?>" /><?php endif;?>
	
	<link rel='image_src' href='http://static.you2play.com/assets/images/default/you2play_logo.png' />
<!--	<style type="text/css">
		@font-face {
		    font-family: 'quarkbold';
		    src: url('fonts/quark-bold-webfont.eot');
		    src: url('fonts/quark-bold-webfont.eot?#iefix') format('embedded-opentype'),
		         url('fonts/quark-bold-webfont.woff') format('woff'),
		         url('fonts/quark-bold-webfont.ttf') format('truetype'),
		         url('fonts/quark-bold-webfont.svg#quarkbold') format('svg');
		    font-weight: normal;
		    font-style: normal;

		}
		@font-face {
		    font-family: 'quarklight';
		    src: url('fonts/quark-light-webfont.eot');
		    src: url('fonts/quark-light-webfont.eot?#iefix') format('embedded-opentype'),
		         url('fonts/quark-light-webfont.woff') format('woff'),
		         url('fonts/quark-light-webfont.ttf') format('truetype'),
		         url('fonts/quark-light-webfont.svg#quarklight') format('svg');
		    font-weight: normal;
		    font-style: normal;

		}	
	</style>-->
	<script type="text/javascript">
	 	/*Set Initail*/
		document.domain = 'you2play.com';
		var web_path = '<?php echo base_url();?>';
		var protocol = (window.location.protocol == "https:" ? "https":"http");
		if(protocol == "https") window.location.href = window.location.href.replace(protocol,'http');
	</script>
	
    <!--Load Js-->
    <?php 
    if(!empty($js)):
            foreach($js as $value):
                    if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/js/'.$value)) && !empty($value)):
                            echo js_asset($value)."\n";				
                    endif;
            endforeach;
    endif;
    ?>
    <!--Load Css-->
    <?php 
    if(!empty($css)):
            foreach($css as $value):
                    if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/css/'.$value)) && !empty($value)):
                            echo css_asset($value,'', array('media'=>'all'))."\n";			
                    endif;
            endforeach;
    endif;
    ?>
    <!--Load External Js-->
    <?php
    if(!empty($external_js)):
	?>
	<script type="text/javascript" language="javascript">
    	<?php echo $external_js;?>
	</script>
	<?php
    endif;
    ?>
    <!--Load External Css-->
    <?php
    if(!empty($external_css)):
	?>
	<style type="text/css">
    	<?php echo $external_css;?>
	</style>
	<?php
    endif;
    ?>	
</head>
<body>
	<!--Wrap All-->
<!--	<div id="wrap_all">
		<div class="top">
			<iframe width="990" scrolling="no" height="40" frameborder="0" src="http://ads.you2play.com/openx/delivery/afr.php?zoneid=145&amp;cb=INSERT_RANDOM_NUMBER_HERE" name="a84bea14" id="a84bea14"></iframe>
		</div>
		<div class="left">
			<iframe width="160" scrolling="no" height="600" frameborder="0" src="http://ads.you2play.com/openx/delivery/afr.php?zoneid=132&amp;cb=INSERT_RANDOM_NUMBER_HERE" name="aeb160a1" id="aeb160a1"></iframe>			
		</div>
		<div class="right">
			<iframe width="160" scrolling="no" height="600" frameborder="0" src="http://ads.you2play.com/openx/delivery/afr.php?zoneid=133&amp;cb=INSERT_RANDOM_NUMBER_HERE" name="a356076c" id="a356076c"></iframe>			
		</div>
	</div>-->
	<!--Wrapper-->
	<div id="wrapper">
		<div id="container">
			<!--Header-->
			<div id="header">
				<a id="you2play_logo" href="<?php echo $main_url;?>"></a>
				<!--<div id="top_banner"><?php CI('banner_leader_board'); //Load Leader Board?></div>-->
				<div id="top_search">
					<?php //echo $this->router->class;?>
					<input type="text" name="txtSearch-all" autocomplete="off"/> <a href="javascript:void(0);" class="btnSearch"></a>
				</div>
				<div id="top_login">
					<div id="module_login" <?php echo (!$member ? '':'style="display:none;"');?>>
						<a title="login facebook" href="javascript:void(0);" onclick="javascript:fbLogin();">
							<?php echo image_asset('default/fb_login.png','',array('width' => 127,'height' => 22,'title' => 'login facebook','alt' => 'login facebook'));?>	
						</a>
						<div><a href="<?php echo $main_url.'user/register/?.&amp;ret='.base_url();?>">สมัครสมาชิก</a><span class="grey"> l </span><a href="javascript:void(0);" id="top_login_floating_toggle">เข้าระบบ</a></div>
					</div>
					<div id="module_logout" <?php echo (!$member ? 'style="display:none;"':'');?>>
						<a href="<?php echo $main_url.'member/edit_profile';?>" class="memberName" target="_blank"><?php echo @$member['username'];?></a>
						<a href="javascript:void(0);" onclick="javascript:memberLogout();">ออกจากระบบ</a>
					</div>
				</div>
			</div>
			<!--Floating Login-->
			<div id="top_login_floating">
				<div class="arrowUp"></div>
				<div class="floatLeft">
					<input type="text" name="f_username" id="f_username" class="input" placeholder="username" autocomplete="off"/>
					<input type="password" name="f_password" id="f_password" class="input" placeholder="password" autocomplete="off"/>
				</div>
				<div class="floatRight">
					<a href="javascript:void(0);" class="btnLogin"></a>
				</div>
				<div class="clear"></div>
				<input type="checkbox" name="f_rememberme" id="f_rememberme"> บันทึกรหัสผ่าน l <a href="<?php echo $main_url.'member/forgot_password/';?>" target="_self">ลืมรหัสผ่าน</a>
			</div>
			<!--Top Menu-->
			<div id="top_menu2">
				<ul>
					<li><a title="หน้าแรก" href="<?php echo $main_url;?>" class="topMenu2 home">หน้าแรก</a></li>
					<li><a title="เพลลิสต์" href="<?php echo $main_url.'comingsoon';?>" class="topMenu2 playlist">เพลลิสต์</a></li>
					<li><a title="ศิลปิน" href="<?php echo $artist_url;?>" class="topMenu2 artist">ศิลปิน</a></li>
					<li><a title="เพลง" href="<?php echo $music_url;?>" class="topMenu2 music">เพลง</a></li>
					<li><a title="คอร์ดเพลง" href="<?php echo $main_url.'comingsoon';?>" class="topMenu2 chord">คอร์ดเพลง</a></li>
					<li><a title="วีดีโอ" href="<?php echo $video_url;?>" class="topMenu2 video">วีดีโอ</a></li>
					<li><a title="ภาพยนตร์" href="<?php echo $movie_url;?>" class="topMenu2 movie">ภาพยนตร์</a></li>
					<li><a title="ข่าว/บทความ" href="<?php echo $news_url;?>" class="topMenu2 news">ข่าว/บทความ</a></li>
					<li><a title="แฟชั่น" href="<?php echo $fashion_url;?>" class="topMenu2 fashion">แฟชั่น</a></li>
					<li><a title="แกลเลอรี่" href="<?php echo $gallery_url;?>" class="topMenu2 shop">แกลเลอรี่</a></li>
				</ul>
				<!--You2play Tv Link-->
				<a id="top_you2play_tv" href="http://www.you2play.com/live"><?php echo image_asset('default/you2play_live_tv.png','',array('width' => 79,'height' => 59));?></a>
			</div>
			<!--Nav Menu-->
			<?php if(isset($top_sub_menu) && !empty($top_sub_menu)) echo $top_sub_menu;?>	
			<!--Content-->
			<div id="content">
				<?php echo $this->load->view($content);?>
			</div>		
		</div>
	</div>
	<!--Footer-->
	<div id="footer_external">
		<div id="footer">
			<div id="footer-logo-detail">
				<ul>
					<li class="first"><a href="<?php echo $main_url;?>" title="หน้าแรก">หน้าแรก</a>|</li>
					<li><a href="<?php echo $artist_url;?>" title="">ศิลปิน</a>|</li>
					<li> <a href="<?php echo $music_url;?>" title="ฟังเพลง">ฟังเพลง</a>|</li>
					<li><a href="<?php echo $video_url;?>" title="วีดีโอ">วีดีโอ</a>|</li>
					<li><a href="<?php echo $main_url.'live';?>" title="you2playTV">ดูทีวี</a>|</li>
					<li><a href="<?php echo $movie_url;?>" title="ดูหนัง">ดูหนัง</a>|</li>
					<li><a href="<?php echo $news_url;?>" title="ข่าวและกิจกรรม">ข่าวบันเทิง</a>|</li>
					<li><a href="<?php echo $fashion_url;?>" title="แฟชั่น">แฟชั่น</a>|</li>
					<li><a href="<?php echo $main_url.'member/profile';?>" title="มุมสมาชิก">มุมสมาชิก</a>|</li>
					<li><a href="<?php echo $main_url.'career';?>" title="ร่วมงานกับ You2Play">ร่วมงานกับ You2Play</a>|</li>
					<li><a href="<?php echo $main_url.'contact';?>" title="ติดต่อเรา">ติดต่อเรา</a>|</li>
					<li><a href="<?php echo $main_url.'content/advertising';?>" title="ติดต่อโฆษณา" class="advertising">ติดต่อโฆษณา</a></li>
				</ul>
				<div>
					หากคุณต้องการ แนะนำ ติ-ชม หรือมีข่าวสารที่น่าสนใจต้องการนำเสนอผ่านเว็บไซต์ <a title="ฟังเพลง" href="<?php echo $main_url;?>">you2play.com</a> ติดต่อมาที่ <a href="mailto:webmaster@you2play.com" title="webmaster@you2play.com" target="_blank">webmaster@you2play.com</a>			
				</div>
			</div>	
	 	</div>
	</div>
	<div id="toTop">^ Back to Top</div>
	<div id="fb-root"></div>
	<script>
		window.fbAsyncInit = function()
		{
			// init the FB JS SDK
			FB.init(
				{
					appId      : '<?php echo $this->config->item("fb_api");?>', // App ID from the App Dashboard
					//channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File for x-domain communication
					status     : true, // check the login status upon init?
					cookie     : true, // set sessions cookies to allow your server to access the session?
					xfbml      : true  // parse XFBML tags on this page?
				});

			// Additional initialization code such as adding Event Listeners goes here
			/*				FB.getLoginStatus(function(response)
			{
			if (response.status === 'connected')
			{
			// connected
			$('#module_login').hide();
			$('#module_logout').show();
			} else if (response.status === 'not_authorized')
			{
			// not_authorized
			} else
			{
			// not_logged_in
			}
			});*/
		};

		// Load the SDK's source Asynchronously
		// Note that the debug version is being actively developed and might
		// contain some type checks that are overly strict.
		// Please report such bugs using the bugs tool.
		(function(d, debug)
			{
				var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
				if (d.getElementById(id))
				{
					return;
				}
				js = d.createElement('script'); js.id = id; js.async = true;
				js.src = "//connect.facebook.net/th_TH/all" + (debug ? "/debug" : "") + ".js";
				ref.parentNode.insertBefore(js, ref);
			}(document, /*debug*/ false));

		//Login && Logout
		function fbLogin()
		{
			FB.login(function(response)
				{
					if (response.authResponse)
					{
						// connected
						FB.api('/me', function(response)
							{
								$.ajax(
									{
										url:web_path+'ajax_member_login',
										type:'post',
										data:(
											{
												fb_id:response.id,
												username:response.username
											}),
										dataType:'json'
									}).done(function(data)
									{
										if(data.error == 1)
										{
											alert(data.msg);
										} else
										{
											//Set Memer
											$('.memberName').html(''+data.member.username+'');
											//Show Result
											$('#module_login').hide();
											$('#module_logout').show();
											//Empty Value
											$('#top_login_floating').find('input').val('');
										}
									});
							});
					} else
					{
						// cancelled
						//window.location.href = window.location.href.replace(window.location.hash,'');
					}
				});
		}

		function memberLogout()
		{
			$.ajax(
				{
					url:web_path+'ajax_member_logout',
					type:'get'
				}).done(function(data)
				{
					//Show Result
					$('#module_logout').hide();
					$('#module_login').show();
				});
		}
	</script>	
</body>
</html>